package cn.com.blueInfo.bpm.template.enums;

import cn.com.blueInfo.bpm.common.enums.BaseEnum;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author suxch
 * @since 2025/8/28 22:57
 */
@Getter
@AllArgsConstructor
public enum WorkItemStatus implements BaseEnum<String> {

    /** 任务状态-待办 */
    TODO("TODO", "待办"),
    /** 任务状态-处理中 */
    IN_PROCESS("IN_PROCESS", "处理中"),
    /** 任务状态-已完成 */
    COMPLETED("COMPLETED", "已完成"),
    /** 任务状态-已取消 */
    CANCELED("CANCELED", "已取消");

    @EnumValue
    private final String code;

    @JsonValue
    private final String desc;

    public static WorkItemStatus getByCode(String code) {
        return BaseEnum.getByCode(WorkItemStatus.class, code);
    }

    @JsonCreator
    public static WorkItemStatus getByName(String name) {
        return BaseEnum.getByName(name, WorkItemStatus.class);
    }

}
